package com.vincent.template.domain;

import com.vincent.template.commons.base.BaseIdEntity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * 绑定 用户-角色
 * @Author Vincent Wang
 * @Date 2020/10/21 14:32
 */
@Entity
@Table(name = "sys_bind_user_role",
        indexes = {@Index(name = "idx_roleId", columnList = "roleId")},
        uniqueConstraints = {@UniqueConstraint(name = "UK_userId_roleId", columnNames = {"userId","roleId"})})
public class SysBindUserRolePo extends BaseIdEntity {

    /**
     * 用户ID
     */
    @Column(nullable = false, length = 40)
    private String userId;
    /**
     * 角色ID
     */
    @Column(nullable = false)
    private Long roleId;

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public Long getRoleId() {
        return roleId;
    }

    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }

    public SysBindUserRolePo() {
    }

    public SysBindUserRolePo(String userId, Long roleId) {
        this.userId = userId;
        this.roleId = roleId;
    }
}
